package vng.wcc.sonph.LauncherGenerator;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

public abstract class LauncherGenerator extends Activity {


//	private static final String CURRRENT_SCREEN_ID = "currentScreenId";
	/** Called when the activity is first created. */	
	private LauncherView launcherView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

	}

//	@Override
//	protected void onSaveInstanceState(Bundle outState) {
//		outState.putInt(CURRRENT_SCREEN_ID, launcherView.getCurrentScreenId());
//	}
	/**
	 * Create the launcher (contains several screens) 
	 * @param items Items to show, each item contains info about the shortcut: icon,title,intent to launch
	 * @param numColsPerPage number of columns per page
	 *  
	 */
	protected void createLauncherView(CellInfo[][] items,int numColsPerPage) {
		//TODO: how to re-use Formatter
		Formatter formatter = new Formatter(this, numColsPerPage);
		this.launcherView = new LauncherView(this, items, formatter, numColsPerPage);		
		this.launcherView.setToScreen(launcherView.getCurrentScreenId());		
	}

	/** 
	 * @return a LauncherView (which extends ViewFlipper)
	 */
	public LauncherView getRootView() {
		return this.launcherView;
	}
}
